package com.cskaoyan.controller;

import com.cskaoyan.bean.BasePageData;
import com.cskaoyan.bean.BaseParam;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.service.UserService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin/user")
public class UserController {

    @Autowired
    UserService userService;

    //多个value值之间的关系，默认是And的关系
    //通过logical配置多个值之间的关系，默认值是and
    @RequiresPermissions(value = {"admin:user:list","songge:user"},
            logical = Logical.OR)
    @RequestMapping("list")
    public BaseRespVo list(String username, String mobile, BaseParam param) {
        BasePageData data = userService.query(username,mobile,param);

        return BaseRespVo.ok(data);
    }
}
